import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Book from '../views/book/Book.vue'
import About from '../views/About.vue'
import AddBook from '../views/book/Add.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/about',
    children: [
      { path: '/book', component: Book, name: 'Book' },
      { path: '/about', component: About, name: 'About' },
      { path: '/add', component: AddBook, name: 'AddBook' }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
